package com.example.s09thymeleaf.entity;


import lombok.Data;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.Range;

import javax.validation.constraints.*;

@Data
public class Commodity {
    @NotNull(message = "不能为空")
    @Positive(message = "必须为正值")
    private Integer pid;
    @NotBlank(message = "必须输入名称")
    private String pname;
    @Pattern(regexp = "^[1-9] [1-9][A-Z]$",message = "分类不合法")
    private  String tcode;
    @Digits(integer = 5,fraction = 2,message = "精度不符合要求")
    @DecimalMin(value = "0.00",message = "价格不能小于0")
    @DecimalMax(value = "10000.00",message = "价格不能大于一万")
    private Float pprice;
    @Range(min = 0,max = 9999,message = "库存超范围")
    private Integer stocks;
    @Length(min = 1,max = 32,message = "内容过于长")
    private  String textadv;
}
